Hệ thống đặt hàng thực phẩm trong Php

1 <?php
2 include
'includes/connect.php';
3     
if($_SESSION['admin_sid']==session_id())
4     {
5         ?>
6 <!DOCTYPE html>
7 <html lang=
"en">
8
9 <head>
10   <meta http-equiv=
"Content-Type" content="text/html; charset=UTF-8">
11   <meta name=
"viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
12   <meta http-equiv=
"X-UA-Compatible" content="IE=edge">
13   <meta name=
"msapplication-tap-highlight" content="no">
14   <title>All orders</title>
15
16   <!-- Favicons-->
17   <link rel=
"icon" href="images/favicon/favicon-32x32.png" sizes="32x32">
18   <!-- Favicons-->
19   <link rel=
"apple-touch-icon-precomposed" href="images/favicon/apple-touch-icon-152x152.png">
20   <!-- For iPhone -->
21   <meta name=
"msapplication-TileColor" content="#00bcd4">
22   <meta name=
"msapplication-TileImage" content="images/favicon/mstile-144x144.png">
23   <!-- For Windows Phone -->
24
25
26   <!-- CORE CSS-->
27   <link href=
"css/materialize.min.css" type="text/css" rel="stylesheet" media="screen,projection">
28   <link href=
"css/style.min.css" type="text/css" rel="stylesheet" media="screen,projection">
29   <!-- Custome CSS-->
30   <link href=
"css/custom/custom.min.css" type="text/css" rel="stylesheet" media="screen,projection">
31
32   <!-- INCLUDED PLUGIN CSS ON THIS PAGE -->
33   <link href=
"js/plugins/perfect-scrollbar/perfect-scrollbar.css" type="text/css" rel="stylesheet" media="screen,projection">
34  
35 </head>
36
37 <body>
38   <!-- Start Page Loading -->
39   <div id=
"loader-wrapper">
40       <div id=
"loader"></div>
41       <div
class="loader-section section-left"></div>
42       <div
class="loader-section section-right"></div>
43   </div>
44   <!-- End Page Loading -->
45
46   <!--
//////////////////////////////////////////////////////////////////////////// -->
47
48   <!-- START HEADER -->
49   <header id=
"header" class="page-topbar">
50         <!-- start header nav-->
51         <div
class="navbar-fixed">
52             <nav
class="navbar-color">
53                 <div
class="nav-wrapper">
54                     <ul
class="left">
55                       <li><h1
class="logo-wrapper"><a href="index.php" class="brand-logo darken-1"><img src="images/materialize-logo.png" alt="logo"></a> <span class="logo-text">Logo</span></h1></li>
56                     </ul>
57                 </div>
58             </nav>
59         </div>
60         <!-- end header nav-->
61   </header>
62   <!-- END HEADER -->
63
64   <!--
//////////////////////////////////////////////////////////////////////////// -->
65
66   <!-- START MAIN -->
67   <div id=
"main">
68     <!-- START WRAPPER -->
69     <div
class="wrapper">
70
71       <!-- START LEFT SIDEBAR NAV-->
72       <aside id=
"left-sidebar-nav">
73         <ul id=
"slide-out" class="side-nav fixed leftside-navigation">
74             <li
class="user-details cyan darken-2">
75             <div
class="row">
76                 <div
class="col col s4 m4 l4">
77                     <img src=
"images/avatar.jpg" alt="" class="circle responsive-img valign profile-image">
78                 </div>
79                 <div
class="col col s8 m8 l8">
80                     <ul id=
"profile-dropdown" class="dropdown-content">
81                         <li><a href=
"routers/logout.php"><i class="mdi-hardware-keyboard-tab"></i> Logout</a>
82                         </li>
83                     </ul>
84                 </div>
85                 <div
class="col col s8 m8 l8">
86                     <a
class="btn-flat dropdown-button waves-effect waves-light white-text profile-btn" href="#" data-activates="profile-dropdown"><?php echo $name;?> <i class="mdi-navigation-arrow-drop-down right"></i></a>
87                     <p
class="user-roal"><?php echo $role;?></p>
88                 </div>
89             </div>
90             </li>
91             <li
class="bold"><a href="index.php" class="waves-effect waves-cyan"><i class="mdi-editor-border-color"></i> Food Menu</a>
92             </li>
93                 <li
class="no-padding">
94                     <ul
class="collapsible collapsible-accordion">
95                         <li
class="bold"><a class="collapsible-header waves-effect waves-cyan active"><i class="mdi-editor-insert-invitation"></i> Orders</a>
96                             <div
class="collapsible-body">
97                                 <ul>
98                                 <li
class="<?php
99                                 
if(!isset($_GET['status'])){
100                                         echo 'active';
101                                     }?>
102                                     "
><a href="all-orders.php">All Orders</a>
103                                 </li>
104                                 <?php
105                                     $sql = mysqli_query($con,
"SELECT DISTINCT status FROM orders;");
106                                     
while($row = mysqli_fetch_array($sql)){
107                                     
if(isset($_GET['status'])){
108                                         $status = $row[
'status'];
109                                     }
110                                     echo
'<li class='.(isset($_GET['status'])?($status == $_GET['status'] ? 'active' : ''): '').'><a href="all-orders.php?status='.$row['status'].'">'.$row['status'].'</a>
111                                     </li>
';
112                                     }
113                                     ?>
114                                 </ul>
115                             </div>
116                         </li>
117                     </ul>
118                 </li>
119                  <li
class="no-padding">
120                     <ul
class="collapsible collapsible-accordion">
121                         <li
class="bold"><a class="collapsible-header waves-effect waves-cyan"><i class="mdi-action-question-answer"></i> Tickets</a>
122                             <div
class="collapsible-body">
123                                 <ul>
124                                 <li><a href=
"all-tickets.php">All Tickets</a>
125                                 </li>
126                                 <?php
127                                     $sql = mysqli_query($con,
"SELECT DISTINCT status FROM tickets;");
128                                     
while($row = mysqli_fetch_array($sql)){
129                                     echo
'<li><a href="all-tickets.php?status='.$row['status'].'">'.$row['status'].'</a>
130                                     </li>
';
131                                     }
132                                     ?>
133                                 </ul>
134                             </div>
135                         </li>
136                     </ul>
137                 </li>
138             <li
class="bold"><a href="users.php" class="waves-effect waves-cyan"><i class="mdi-social-person"></i> Users</a>
139             </li>
140         </ul>
141         <a href=
"#" data-activates="slide-out" class="sidebar-collapse btn-floating btn-medium waves-effect waves-light hide-on-large-only cyan"><i class="mdi-navigation-menu"></i></a>
142         </aside>
143       <!-- END LEFT SIDEBAR NAV-->
144
145       <!--
//////////////////////////////////////////////////////////////////////////// -->
146
147       <!-- START CONTENT -->
148       <section id=
"content">
149
150         <!--breadcrumbs start-->
151         <div id=
"breadcrumbs-wrapper">
152           <div
class="container">
153             <div
class="row">
154               <div
class="col s12 m12 l12">
155                 <h5
class="breadcrumbs-title">All Orders</h5>
156               </div>
157             </div>
158           </div>
159         </div>
160         <!--breadcrumbs end-->
161
162
163         <!--start container-->
164         <div
class="container">
165           <p
class="caption">List of orders by customers with details</p>
166           <div
class="divider"></div>
167           <!--editableTable-->
168 <div id=
"work-collections" class="seaction">
169              
170                     <?php
171                     
if(isset($_GET['status'])){
172                         $status = $_GET[
'status'];
173                     }
174                     
else{
175                         $status =
'%';
176                     }
177                     $sql = mysqli_query($con,
"SELECT * FROM orders WHERE status LIKE '$status';");
178                     echo
'<div class="row">
179                 <div>
180                     <h4
class="header">List</h4>
181                     <ul id=
"issues-collection" class="collection">';
182                     
while($row = mysqli_fetch_array($sql))
183                     {
184                         $status = $row[
'status'];
185                         $deleted = $row[
'deleted'];
186                         echo
'<li class="collection-item avatar">
187                               <i
class="mdi-content-content-paste red circle"></i>
188                               <span
class="collection-header">Order No. '.$row['id'].'</span>
189                               <p><strong>Date:</strong>
'.$row['date'].'</p>
190                               <p><strong>Payment Type:</strong>
'.$row['payment_type'].'</p>
191                               <p><strong>Status:</strong>
'.($deleted ? $status : '
192                               <form method=
"post" action="routers/edit-orders.php">
193                                 <input type=
"hidden" value="'.$row['id'].'" name="id">
194                                 <
select name="status">
195                                 <option
value="Yet to be delivered" '.($status=='Yet to be delivered' ? 'selected' : '').'>Yet to be delivered</option>
196                                 <option
value="Delivered" '.($status=='Delivered' ? 'selected' : '').'>Delivered</option>
197                                 <option
value="Cancelled by Admin" '.($status=='Cancelled by Admin' ? 'selected' : '').'>Cancelled by Admin</option>
198                                 <option
value="Paused" '.($status=='Paused' ? 'selected' : '').'>Paused</option>
199                                 </
select>
200                               
').'</p>
201                               <a href=
"#" class="secondary-content"><i class="mdi-action-grade"></i></a>
202                               </li>
';
203                         $order_id = $row[
'id'];
204                         $customer_id = $row[
'customer_id'];
205                         $sql1 = mysqli_query($con,
"SELECT * FROM order_details WHERE order_id = $order_id;");
206                         $sql3 = mysqli_query($con,
"SELECT * FROM users WHERE id = $customer_id;");
207                             
while($row3 = mysqli_fetch_array($sql3))
208                             {
209                             echo
'<li class="collection-item">
210                             <div
class="row">
211                             <p><strong>Name: </strong>
'.$row3['name'].'</p>
212                             <p><strong>Address: </strong>
'.$row['address'].'</p>
213                             
'.($row3['contact'] == '' ? '' : '<p><strong>Contact: </strong>'.$row3['contact'].'</p>').'
214                             
'.($row3['email'] == '' ? '' : '<p><strong>Email: </strong>'.$row3['email'].'</p>').'
215                             
'.(!empty($row['description']) ? '<p><strong>Note: </strong>'.$row['description'].'</p>' : '').'
216                             </li>
';
217                             }
218                         
while($row1 = mysqli_fetch_array($sql1))
219                         {
220                             $item_id = $row1[
'item_id'];
221                             $sql2 = mysqli_query($con,
"SELECT * FROM items WHERE id = $item_id;");
222                             
while($row2 = mysqli_fetch_array($sql2))
223                                 $item_name = $row2[
'name'];
224                             echo
'<li class="collection-item">
225                             <div
class="row">
226                             <div
class="col s7">
227                             <p
class="collections-title"><strong>#'.$row1['item_id'].'</strong> '.$item_name.'</p>
228                             </div>
229                             <div
class="col s2">
230                             <span>
'.$row1['quantity'].' Pieces</span>
231                             </div>
232                             <div
class="col s3">
233                             <span>Rs.
'.$row1['price'].'</span>
234                             </div>
235                             </div>
236                             </li>
';
237                         }
238                                 echo
'<li class="collection-item">
239                                         <div
class="row">
240                                             <div
class="col s7">
241                                                 <p
class="collections-title"> Total</p>
242                                             </div>
243                                             <div
class="col s2">
244                                             <span> </span>
245                                             </div>
246                                             <div
class="col s3">
247                                                 <span><strong>Rs.
'.$row['total'].'</strong></span>
248                                             </div>
';
249                                 
if(!$deleted){
250                                 echo
'<button class="btn waves-effect waves-light right submit" type="submit" name="action">Change Status
251                                               <i
class="mdi-content-clear right"></i>
252                                         </button>
253                                         </form>
';
254                                 }
255                                 echo
'</div></li>';
256                     }
257                     ?>
258                     </ul>
259                 </div>
260               </div>
261             </div>
262         </div>
263         <!--end container-->
264
265       </section>
266       <!-- END CONTENT -->
267     </div>
268     <!-- END WRAPPER -->
269
270   </div>
271   <!-- END MAIN -->
272
273
274
275   <!--
//////////////////////////////////////////////////////////////////////////// -->
276
277   <!-- START FOOTER -->
278   <footer
class="page-footer">
279     <div
class="footer-copyright">
280       <div
class="container">
281         <span>Copyright ©
2017 <a class="grey-text text-lighten-4" href="#" target="_blank">Students</a> All rights reserved.</span>
282         <span
class="right"> Design and Developed by <a class="grey-text text-lighten-4" href="#">Students</a></span>
283         </div>
284     </div>
285   </footer>
286     <!-- END FOOTER -->
287
288
289
290     <!-- ================================================
291     Scripts
292     ================================================ -->
293     
294     <!-- jQuery Library -->
295     <script type=
"text/javascript" src="js/plugins/jquery-1.11.2.min.js"></script>
296     <!--angularjs-->
297     <script type=
"text/javascript" src="js/plugins/angular.min.js"></script>
298     <!--materialize js-->
299     <script type=
"text/javascript" src="js/materialize.min.js"></script>
300     <!--scrollbar-->
301     <script type=
"text/javascript" src="js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
302     <!--plugins.js - Some Specific JS codes
for Plugin Settings-->
303     <script type=
"text/javascript" src="js/plugins.min.js"></script>
304     <!--custom-script.js - Add your own theme custom JS-->
305     <script type=
"text/javascript" src="js/custom-script.js"></script>
306 </body>
307
308 </html>
309 <?php
310     }
311     
else
312     {
313         
if($_SESSION['customer_id']==session_id())
314         {
315             header(
"location:orders.php");
316         }
317         
else{
318             header(
"location:login.php");
319         }
320     }
321 ?>


Gõ tìm kiếm nhanh...